root/trunk/lib/cc3-ilp/cc3_ilp.c

Revision 415, 1.7 kB (checked in by anthony_rowe, 2 years ago)

no more GUI hang leaving line mode

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1 /*
2  * Copyright 2006-2007  Anthony Rowe and Adam Goode
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18
19 #include "cc3.h"
20 #include "cc3_ilp.h"
21 #include <stdbool.h>
22 #include <stdio.h>
23 #include <stdlib.h>
24
25 uint8_t cc3_load_img_rows (cc3_image_t * img, uint16_t rows)
26 {
27
28
29 }
30
31 inline void cc3_get_pixel (cc3_image_t * img, uint16_t x, uint16_t y,
32                     cc3_pixel_t * out_pix)
33 {
34   if (img->channels > 1) {
35     out_pix->channel[0] = ((uint8_t *) img->pix)[y * img->width + (x * 3)];
36     out_pix->channel[1] =
37       ((uint8_t *) img->pix)[y * img->width + (x * 3) + 1];
38     out_pix->channel[2] =
39       ((uint8_t *) img->pix)[y * img->width + (x * 3) + 2];
40   }
41   else {
42     out_pix->channel[0] = ((uint8_t *) img->pix)[y * img->width + x];
43   }
44
45 }
46
47
48 inline void cc3_set_pixel (cc3_image_t * img, uint16_t x, uint16_t y,
49                     cc3_pixel_t * in_pix)
50 {
51   if (img->channels > 1) {
52     ((uint8_t *) img->pix)[y * img->width + (x * 3)] = in_pix->channel[0];
53     ((uint8_t *) img->pix)[y * img->width + (x * 3) + 1] = in_pix->channel[1];
54     ((uint8_t *) img->pix)[y * img->width + (x * 3) + 2] = in_pix->channel[2];
55   }
56   else {
57     ((uint8_t *) img->pix)[y * img->width + x] = in_pix->channel[0];
58   }
59
60
61 }
Note: See TracBrowser for help on using the browser.